#ifndef _DATA_UTILITY_H_
#define _DATA_UTILITY_H_
#include <stdio.h>
#include "typedef.h"

#define NUMBER_BUFF_LEN 50
#define RANDOM_STR_BUFF_LEN 1024
#define BYTES_IN_1G (1024*1024*1024)
#define TRANS_GB_TO_PAGES(gb) (gb * 1024 * 1024 / 8)
#define PAGES_1GB (1024*1024 / 8)

extern char num_buff[NUMBER_BUFF_LEN];
extern char random_str_buff[RANDOM_STR_BUFF_LEN];

void df_error(const char *fmt,...) __attribute__((format(gnu_printf,1,2)));
void df_log(const char *fmt,...) __attribute__((format(gnu_printf,1,2)));
void df_debug(const char *fmt,...) __attribute__((format(gnu_printf,1,2)));
void df_info(const char *fmt,...)  __attribute__((format(gnu_printf,1,2)));
void df_log_0(const char *fmt,...)  __attribute__((format(gnu_printf,1,2)));
void df_exit(char* exit_words);
uint32 str_to_uint32(char* str);
int str_to_int32(char* str);
char* int_to_string(int value, char* buff);
char* int64_to_string(int64 value, char* buff);
char* df_malloc(uint64 size);
uint64 hex_decode(const char *src, size_t len, char *dst);
uint64 str_exchange(const char *src, size_t len, char *dst);
bool is_file_exist(char *path);
void ratio_print(char* ratio_message, int cur, int finish, bool end);
char* random_str(void);

#endif